<template>
	<view class="container">
		<view> 签名 </view>
		<!-- 签名画板如果外层套安全区域，需要重新封装一下即可 -->
		<DrawingBoard
			@onSaveImage="onSaveImage"
			:padding="`88rpx 0rpx 0rpx 0rpx`"
			:offsetCTXTop="88"
			@getTempPath="getTempPath"
		></DrawingBoard>
	</view>
</template>

<script>
import useStore from '@/store/index';
import DrawingBoard from '@/components/DrawingBoard/DrawingBoard.vue';
import { convertTempPath } from '@/utils/convertTempPath';
export default {
	components: { DrawingBoard },
	data() {
		return {
			scrollTop: 0,
			tempImgUrl: '', // 协议图片临时地址
			imgUrl: '', // 协议图片地址
		};
	},
	onLoad() {},
	methods: {
		jump(url) {
			return this.$jump(url);
		},
		onSaveImage(url) {
			// 返回图片url
			console.log('保存图片:', url);
		},
		async getTempPath() {
			const _url = await convertTempPath(this.tempImgUrl);
			const imgUrl = await uploadImg(_url);
			console.log('imgUrl', imgUrl);
		},
	},
};
</script>

<style lang="scss" scoped>
.container {
}
</style>
